<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Stop Token Filter | Elasticsearch Guide [2.4] | Elastic</title>
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
</head>
<body>
<div class="main-container">
    <section id="content">
        
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原文地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/2.4/analysis-stop-tokenfilter.html" rel="nofollow">https://www.elastic.co/guide/en/elasticsearch/reference/2.4/analysis-stop-tokenfilter.html</a>, 版权归 www.elastic.co 所有<br/>
                            英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/2.4/analysis-stop-tokenfilter.html" rel="nofollow">https://www.elastic.co/guide/en/elasticsearch/reference/2.4/analysis-stop-tokenfilter.html</a>
                            </div>
                        <!-- start body -->
                  <div class="page_header">
<p>
  <strong>WARNING</strong>: Version 2.4 of Elasticsearch has passed its 
  <a href="https://www.elastic.co/support/eol">EOL date</a>. 
</p>  
<p>
  This documentation is no longer being maintained and may be removed. 
  If you are running this version, we strongly advise you to upgrade. 
  For the latest information, see the 
  <a href="../current/index.html">current release documentation</a>. 
</p>
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [2.4]</a></span>
»
<span class="breadcrumb-link"><a href="analysis.html">Analysis</a></span>
»
<span class="breadcrumb-link"><a href="analysis-tokenfilters.html">Token Filters</a></span>
»
<span class="breadcrumb-node">Stop Token Filter</span>
</div>
<div class="navheader">
<span class="prev">
<a href="analysis-shingle-tokenfilter.html">« Shingle Token Filter</a>
</span>
<span class="next">
<a href="analysis-word-delimiter-tokenfilter.html">Word Delimiter Token Filter »</a>
</span>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="analysis-stop-tokenfilter"></a>Stop Token Filter<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/2.4/docs/reference/analysis/tokenfilters/stop-tokenfilter.asciidoc">edit</a>
</h2>
</div></div></div>
<p>A token filter of type <code class="literal">stop</code> that removes stop words from token
streams.</p>
<p>The following are settings that can be set for a <code class="literal">stop</code> token filter
type:</p>
<div class="informaltable">
<table border="0" cellpadding="4px">
<colgroup>
<col>
<col>
</colgroup>
<tbody valign="top">
<tr>
<td valign="top">
<p>
<code class="literal">stopwords</code>
</p>
</td>
<td valign="top">
<p>
A list of stop words to use. Defaults to <code class="literal">_english_</code> stop words.
</p>
</td>
</tr>
<tr>
<td valign="top">
<p>
<code class="literal">stopwords_path</code>
</p>
</td>
<td valign="top">
<p>
A path (either relative to <code class="literal">config</code> location, or absolute) to a stopwords
file configuration. Each stop word should be in its own "line" (separated
by a line break). The file must be UTF-8 encoded.
</p>
</td>
</tr>
<tr>
<td valign="top">
<p>
<code class="literal">ignore_case</code>
</p>
</td>
<td valign="top">
<p>
Set to <code class="literal">true</code> to lower case all words first. Defaults to <code class="literal">false</code>.
</p>
</td>
</tr>
<tr>
<td valign="top">
<p>
<code class="literal">remove_trailing</code>
</p>
</td>
<td valign="top">
<p>
Set to <code class="literal">false</code> in order to not ignore the last term of a search if it is a
stop word. This is very useful for the completion suggester as a query
like <code class="literal">green a</code> can be extended to <code class="literal">green apple</code> even though you remove
stop words in general. Defaults to <code class="literal">true</code>.
</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>The <code class="literal">stopwords</code> parameter accepts either an array of stopwords:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">PUT /my_index
{
    "settings": {
        "analysis": {
            "filter": {
                "my_stop": {
                    "type":       "stop",
                    "stopwords": ["and", "is", "the"]
                }
            }
        }
    }
}</pre>
</div>
<p>or a predefined language-specific list:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">PUT /my_index
{
    "settings": {
        "analysis": {
            "filter": {
                "my_stop": {
                    "type":       "stop",
                    "stopwords":  "_english_"
                }
            }
        }
    }
}</pre>
</div>
<p>Elasticsearch provides the following predefined list of languages:</p>
<p><code class="literal">_arabic_</code>, <code class="literal">_armenian_</code>, <code class="literal">_basque_</code>, <code class="literal">_brazilian_</code>, <code class="literal">_bulgarian_</code>,
<code class="literal">_catalan_</code>, <code class="literal">_czech_</code>, <code class="literal">_danish_</code>, <code class="literal">_dutch_</code>, <code class="literal">_english_</code>, <code class="literal">_finnish_</code>,
<code class="literal">_french_</code>, <code class="literal">_galician_</code>, <code class="literal">_german_</code>, <code class="literal">_greek_</code>, <code class="literal">_hindi_</code>, <code class="literal">_hungarian_</code>,
<code class="literal">_indonesian_</code>, <code class="literal">_irish_</code>, <code class="literal">_italian_</code>, <code class="literal">_latvian_</code>, <code class="literal">_norwegian_</code>, <code class="literal">_persian_</code>,
<code class="literal">_portuguese_</code>, <code class="literal">_romanian_</code>, <code class="literal">_russian_</code>, <code class="literal">_sorani_</code>, <code class="literal">_spanish_</code>,
<code class="literal">_swedish_</code>, <code class="literal">_thai_</code>, <code class="literal">_turkish_</code>.</p>
<p>For the empty stopwords list (to disable stopwords) use: <code class="literal">_none_</code>.</p>
</div>
<div class="navfooter">
<span class="prev">
<a href="analysis-shingle-tokenfilter.html">« Shingle Token Filter</a>
</span>
<span class="next">
<a href="analysis-word-delimiter-tokenfilter.html">Word Delimiter Token Filter »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>